home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsITimer.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  13KB  |  372 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsITimer.idl
  3.  */
  4.  
  5. #ifndef __gen_nsITimer_h__
  6. #define __gen_nsITimer_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIObserver; /* forward declaration */
  18.  
  19. /**
  20.  * The signature of the timer callback function passed to initWithFuncCallback.
  21.  * This is the function that will get called when the timer expires if the
  22.  * timer is initialized via initWithFuncCallback.
  23.  *
  24.  * @param aTimer the timer which has expired
  25.  * @param aClosure opaque parameter passed to initWithFuncCallback
  26.  *
  27.  * Implementers should return the following:
  28.  *
  29.  * @return NS_OK
  30.  *
  31.  */
  32. class nsITimer;
  33. typedef void (*nsTimerCallbackFunc) (nsITimer *aTimer, void *aClosure);
  34. class nsITimer; /* forward declaration */
  35.  
  36.  
  37. /* starting interface:    nsITimerCallback */
  38. #define NS_ITIMERCALLBACK_IID_STR "a796816d-7d47-4348-9ab8-c7aeb3216a7d"
  39.  
  40. #define NS_ITIMERCALLBACK_IID \
  41.   {0xa796816d, 0x7d47, 0x4348, \
  42.     { 0x9a, 0xb8, 0xc7, 0xae, 0xb3, 0x21, 0x6a, 0x7d }}
  43.  
  44. class NS_NO_VTABLE nsITimerCallback : public nsISupports {
  45.  public: 
  46.  
  47.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITIMERCALLBACK_IID)
  48.  
  49.   /**
  50.    * @param aTimer the timer which has expired
  51.    */
  52.   /* void notify (in nsITimer timer); */
  53.   NS_IMETHOD Notify(nsITimer *timer) = 0;
  54.  
  55. };
  56.  
  57. /* Use this macro when declaring classes that implement this interface. */
  58. #define NS_DECL_NSITIMERCALLBACK \
  59.   NS_IMETHOD Notify(nsITimer *timer); 
  60.  
  61. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  62. #define NS_FORWARD_NSITIMERCALLBACK(_to) \
  63.   NS_IMETHOD Notify(nsITimer *timer) { return _to Notify(timer); } 
  64.  
  65. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  66. #define NS_FORWARD_SAFE_NSITIMERCALLBACK(_to) \
  67.   NS_IMETHOD Notify(nsITimer *timer) { return !_to ? NS_ERROR_NULL_POINTER : _to->Notify(timer); } 
  68.  
  69. #if 0
  70. /* Use the code below as a template for the implementation class for this interface. */
  71.  
  72. /* Header file */
  73. class nsTimerCallback : public nsITimerCallback
  74. {
  75. public:
  76.   NS_DECL_ISUPPORTS
  77.   NS_DECL_NSITIMERCALLBACK
  78.  
  79.   nsTimerCallback();
  80.  
  81. private:
  82.   ~nsTimerCallback();
  83.  
  84. protected:
  85.   /* additional members */
  86. };
  87.  
  88. /* Implementation file */
  89. NS_IMPL_ISUPPORTS1(nsTimerCallback, nsITimerCallback)
  90.  
  91. nsTimerCallback::nsTimerCallback()
  92. {
  93.   /* member initializers and constructor code */
  94. }
  95.  
  96. nsTimerCallback::~nsTimerCallback()
  97. {
  98.   /* destructor code */
  99. }
  100.  
  101. /* void notify (in nsITimer timer); */
  102. NS_IMETHODIMP nsTimerCallback::Notify(nsITimer *timer)
  103. {
  104.     return NS_ERROR_NOT_IMPLEMENTED;
  105. }
  106.  
  107. /* End of implementation class template. */
  108. #endif
  109.  
  110.  
  111. /* starting interface:    nsITimer */
  112. #define NS_ITIMER_IID_STR "436a83fa-b396-11d9-bcfa-00112478d626"
  113.  
  114. #define NS_ITIMER_IID \
  115.   {0x436a83fa, 0xb396, 0x11d9, \
  116.     { 0xbc, 0xfa, 0x00, 0x11, 0x24, 0x78, 0xd6, 0x26 }}
  117.  
  118. /**
  119.  * The callback interface for timers.
  120.  */
  121. class NS_NO_VTABLE nsITimer : public nsISupports {
  122.  public: 
  123.  
  124.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITIMER_IID)
  125.  
  126.   /**
  127.  * nsITimer instances must be initialized by calling one of the "init" methods
  128.  * documented below.  You may also re-initialize an existing instance with new
  129.  * delay to avoid the overhead of destroying and creating a timer.  It is not
  130.  * necessary to cancel the timer in that case.
  131.  */
  132. /**
  133.    * Type of a timer that fires once only.
  134.    */
  135.   enum { TYPE_ONE_SHOT = 0 };
  136.  
  137.   /**
  138.    * After firing, a TYPE_REPEATING_SLACK timer is stopped and not restarted
  139.    * until its callback completes.  Specified timer period will be at least
  140.    * the time between when processing for last firing the callback completes
  141.    * and when the next firing occurs.
  142.    *
  143.    * This is the preferable repeating type for most situations.
  144.    */
  145.   enum { TYPE_REPEATING_SLACK = 1 };
  146.  
  147.   /**
  148.    * An TYPE_REPEATING_PRECISE repeating timer aims to have constant period
  149.    * between firings.  The processing time for each timer callback should not
  150.    * influence the timer period.  However, if the processing for the last
  151.    * timer firing could not be completed until just before the next firing
  152.    * occurs, then you could have two timer notification routines being
  153.    * executed in quick succession.
  154.    */
  155.   enum { TYPE_REPEATING_PRECISE = 2 };
  156.  
  157.   /**
  158.    * Initialize a timer that will fire after the said delay.
  159.    * A user must keep a reference to this timer till it is 
  160.    * is no longer needed or has been cancelled.
  161.    *
  162.    * @param aObserver   the callback object that observes the 
  163.    *                    ``timer-callback'' topic with the subject being
  164.    *                    the timer itself when the timer fires:
  165.    *
  166.    *                    observe(nsISupports aSubject, => nsITimer
  167.    *                            string aTopic,        => ``timer-callback''
  168.    *                            wstring data          =>  null
  169.    *
  170.    * @param aDelay      delay in milliseconds for timer to fire
  171.    * @param aType       timer type per TYPE* consts defined above
  172.    */
  173.   /* void init (in nsIObserver aObserver, in unsigned long aDelay, in unsigned long aType); */
  174.   NS_IMETHOD Init(nsIObserver *aObserver, PRUint32 aDelay, PRUint32 aType) = 0;
  175.  
  176.   /**
  177.    * Initialize a timer to fire after the given millisecond interval.
  178.    * This version takes a function to call and a closure to pass to
  179.    * that function.
  180.    *
  181.    * @param aFunc      The function to invoke
  182.    * @param aClosure   An opaque pointer to pass to that function
  183.    * @param aDelay     The millisecond interval
  184.    * @param aType      Timer type per TYPE* consts defined above
  185.    */
  186.   /* [noscript] void initWithFuncCallback (in nsTimerCallbackFunc aCallback, in voidPtr aClosure, in unsigned long aDelay, in unsigned long aType); */
  187.   NS_IMETHOD InitWithFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, PRUint32 aDelay, PRUint32 aType) = 0;
  188.  
  189.   /**
  190.    * Initialize a timer to fire after the given millisecond interval.
  191.    * This version takes a function to call and a closure to pass to
  192.    * that function.
  193.    *
  194.    * @param aFunc      nsITimerCallback interface to call when timer expires
  195.    * @param aDelay     The millisecond interval
  196.    * @param aType      Timer type per TYPE* consts defined above
  197.    */
  198.   /* void initWithCallback (in nsITimerCallback aCallback, in unsigned long aDelay, in unsigned long aType); */
  199.   NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, PRUint32 aDelay, PRUint32 aType) = 0;
  200.  
  201.   /**
  202.    * Cancel the timer.  This method works on all types, not just on repeating
  203.    * timers -- you might want to cancel a TYPE_ONE_SHOT timer, and even reuse
  204.    * it by re-initializing it (to avoid object destruction and creation costs
  205.    * by conserving one timer instance).
  206.    */
  207.   /* void cancel (); */
  208.   NS_IMETHOD Cancel(void) = 0;
  209.  
  210.   /**
  211.    * The millisecond delay of the timeout
  212.    */
  213.   /* attribute unsigned long delay; */
  214.   NS_IMETHOD GetDelay(PRUint32 *aDelay) = 0;
  215.   NS_IMETHOD SetDelay(PRUint32 aDelay) = 0;
  216.  
  217.   /**
  218.    * The timer type : one shot or repeating
  219.    */
  220.   /* attribute unsigned long type; */
  221.   NS_IMETHOD GetType(PRUint32 *aType) = 0;
  222.   NS_IMETHOD SetType(PRUint32 aType) = 0;
  223.  
  224.   /**
  225.    * The opaque pointer pass to initWithFuncCallback.
  226.    */
  227.   /* [noscript] readonly attribute voidPtr closure; */
  228.   NS_IMETHOD GetClosure(void * *aClosure) = 0;
  229.  
  230.   /**
  231.    * The nsITimerCallback object passed to initWithCallback.
  232.    */
  233.   /* readonly attribute nsITimerCallback callback; */
  234.   NS_IMETHOD GetCallback(nsITimerCallback * *aCallback) = 0;
  235.  
  236. };
  237.  
  238. /* Use this macro when declaring classes that implement this interface. */
  239. #define NS_DECL_NSITIMER \
  240.   NS_IMETHOD Init(nsIObserver *aObserver, PRUint32 aDelay, PRUint32 aType); \
  241.   NS_IMETHOD InitWithFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, PRUint32 aDelay, PRUint32 aType); \
  242.   NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, PRUint32 aDelay, PRUint32 aType); \
  243.   NS_IMETHOD Cancel(void); \
  244.   NS_IMETHOD GetDelay(PRUint32 *aDelay); \
  245.   NS_IMETHOD SetDelay(PRUint32 aDelay); \
  246.   NS_IMETHOD GetType(PRUint32 *aType); \
  247.   NS_IMETHOD SetType(PRUint32 aType); \
  248.   NS_IMETHOD GetClosure(void * *aClosure); \
  249.   NS_IMETHOD GetCallback(nsITimerCallback * *aCallback); 
  250.  
  251. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  252. #define NS_FORWARD_NSITIMER(_to) \
  253.   NS_IMETHOD Init(nsIObserver *aObserver, PRUint32 aDelay, PRUint32 aType) { return _to Init(aObserver, aDelay, aType); } \
  254.   NS_IMETHOD InitWithFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, PRUint32 aDelay, PRUint32 aType) { return _to InitWithFuncCallback(aCallback, aClosure, aDelay, aType); } \
  255.   NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, PRUint32 aDelay, PRUint32 aType) { return _to InitWithCallback(aCallback, aDelay, aType); } \
  256.   NS_IMETHOD Cancel(void) { return _to Cancel(); } \
  257.   NS_IMETHOD GetDelay(PRUint32 *aDelay) { return _to GetDelay(aDelay); } \
  258.   NS_IMETHOD SetDelay(PRUint32 aDelay) { return _to SetDelay(aDelay); } \
  259.   NS_IMETHOD GetType(PRUint32 *aType) { return _to GetType(aType); } \
  260.   NS_IMETHOD SetType(PRUint32 aType) { return _to SetType(aType); } \
  261.   NS_IMETHOD GetClosure(void * *aClosure) { return _to GetClosure(aClosure); } \
  262.   NS_IMETHOD GetCallback(nsITimerCallback * *aCallback) { return _to GetCallback(aCallback); } 
  263.  
  264. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  265. #define NS_FORWARD_SAFE_NSITIMER(_to) \
  266.   NS_IMETHOD Init(nsIObserver *aObserver, PRUint32 aDelay, PRUint32 aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aObserver, aDelay, aType); } \
  267.   NS_IMETHOD InitWithFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, PRUint32 aDelay, PRUint32 aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->InitWithFuncCallback(aCallback, aClosure, aDelay, aType); } \
  268.   NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, PRUint32 aDelay, PRUint32 aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->InitWithCallback(aCallback, aDelay, aType); } \
  269.   NS_IMETHOD Cancel(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Cancel(); } \
  270.   NS_IMETHOD GetDelay(PRUint32 *aDelay) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDelay(aDelay); } \
  271.   NS_IMETHOD SetDelay(PRUint32 aDelay) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDelay(aDelay); } \
  272.   NS_IMETHOD GetType(PRUint32 *aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetType(aType); } \
  273.   NS_IMETHOD SetType(PRUint32 aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetType(aType); } \
  274.   NS_IMETHOD GetClosure(void * *aClosure) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClosure(aClosure); } \
  275.   NS_IMETHOD GetCallback(nsITimerCallback * *aCallback) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCallback(aCallback); } 
  276.  
  277. #if 0
  278. /* Use the code below as a template for the implementation class for this interface. */
  279.  
  280. /* Header file */
  281. class nsTimer : public nsITimer
  282. {
  283. public:
  284.   NS_DECL_ISUPPORTS
  285.   NS_DECL_NSITIMER
  286.  
  287.   nsTimer();
  288.  
  289. private:
  290.   ~nsTimer();
  291.  
  292. protected:
  293.   /* additional members */
  294. };
  295.  
  296. /* Implementation file */
  297. NS_IMPL_ISUPPORTS1(nsTimer, nsITimer)
  298.  
  299. nsTimer::nsTimer()
  300. {
  301.   /* member initializers and constructor code */
  302. }
  303.  
  304. nsTimer::~nsTimer()
  305. {
  306.   /* destructor code */
  307. }
  308.  
  309. /* void init (in nsIObserver aObserver, in unsigned long aDelay, in unsigned long aType); */
  310. NS_IMETHODIMP nsTimer::Init(nsIObserver *aObserver, PRUint32 aDelay, PRUint32 aType)
  311. {
  312.     return NS_ERROR_NOT_IMPLEMENTED;
  313. }
  314.  
  315. /* [noscript] void initWithFuncCallback (in nsTimerCallbackFunc aCallback, in voidPtr aClosure, in unsigned long aDelay, in unsigned long aType); */
  316. NS_IMETHODIMP nsTimer::InitWithFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, PRUint32 aDelay, PRUint32 aType)
  317. {
  318.     return NS_ERROR_NOT_IMPLEMENTED;
  319. }
  320.  
  321. /* void initWithCallback (in nsITimerCallback aCallback, in unsigned long aDelay, in unsigned long aType); */
  322. NS_IMETHODIMP nsTimer::InitWithCallback(nsITimerCallback *aCallback, PRUint32 aDelay, PRUint32 aType)
  323. {
  324.     return NS_ERROR_NOT_IMPLEMENTED;
  325. }
  326.  
  327. /* void cancel (); */
  328. NS_IMETHODIMP nsTimer::Cancel()
  329. {
  330.     return NS_ERROR_NOT_IMPLEMENTED;
  331. }
  332.  
  333. /* attribute unsigned long delay; */
  334. NS_IMETHODIMP nsTimer::GetDelay(PRUint32 *aDelay)
  335. {
  336.     return NS_ERROR_NOT_IMPLEMENTED;
  337. }
  338. NS_IMETHODIMP nsTimer::SetDelay(PRUint32 aDelay)
  339. {
  340.     return NS_ERROR_NOT_IMPLEMENTED;
  341. }
  342.  
  343. /* attribute unsigned long type; */
  344. NS_IMETHODIMP nsTimer::GetType(PRUint32 *aType)
  345. {
  346.     return NS_ERROR_NOT_IMPLEMENTED;
  347. }
  348. NS_IMETHODIMP nsTimer::SetType(PRUint32 aType)
  349. {
  350.     return NS_ERROR_NOT_IMPLEMENTED;
  351. }
  352.  
  353. /* [noscript] readonly attribute voidPtr closure; */
  354. NS_IMETHODIMP nsTimer::GetClosure(void * *aClosure)
  355. {
  356.     return NS_ERROR_NOT_IMPLEMENTED;
  357. }
  358.  
  359. /* readonly attribute nsITimerCallback callback; */
  360. NS_IMETHODIMP nsTimer::GetCallback(nsITimerCallback * *aCallback)
  361. {
  362.     return NS_ERROR_NOT_IMPLEMENTED;
  363. }
  364.  
  365. /* End of implementation class template. */
  366. #endif
  367.  
  368. #define NS_TIMER_CONTRACTID "@mozilla.org/timer;1"
  369. #define NS_TIMER_CALLBACK_TOPIC "timer-callback"
  370.  
  371. #endif /* __gen_nsITimer_h__ */
  372.